// Package redis_lock
// Created by GoLand
// @User: lenora
// @Date: 2024/8/14
// @Time: 17:40

package redis_lock

import "time"

type RetryStrategy interface {
	Next() (time.Duration, bool)
}

type IntervalRetry struct {
	Interval time.Duration //重试间隔
	Max      int           //最大重试次数
	cnt      int
}

func (r *IntervalRetry) Next() (time.Duration, bool) {
	r.cnt++
	return r.Interval, r.Max > r.cnt
}
